﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;


using ExtAspNet;
using Ylh.BLL;
using System.Data;
using Ylh.FactoryDAL;

public partial class Module_StaffManger_StaffPersonalInfo : PageBase
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Button2.OnClientClick = Window1.GetShowReference("ChangeStaffPwd.aspx", "修改密码");

        if (!IsPostBack)
        {
            LoadStaffData(base.StaffID.ToString());
            LoadStaff(base.StaffID.ToString());
        }
    }

    private void LoadStaffData(string StaffID)
    {
        Ylh.BLL.StaffInfoBLL bll = new Ylh.BLL.StaffInfoBLL(DbConnectionStr);
        Ylh.Model.TbStaffInfo model = bll.GetModel(Convert.ToInt32(StaffID));

        this.sex.SelectedValue = model.Sex;
        this.Birdthday.SelectedDate = Convert.ToDateTime(model.Birdthday);
        this.Tel.Text = model.Tel;
        this.Address.Text = model.Address;
        this.IDCard.Text = model.IDCard;
        if (model.InTime != null)
        {
            this.InTime.SelectedDate = Convert.ToDateTime(model.InTime);
        }
        this.TelPhone.Text = model.TelPhone;
        this.LinkMan.Text = model.LinkMan;
        this.LinkNum.Text = model.LinkNum;
        this.Hometown.Text = model.Hometown;
        this.Marital.SelectedValue = model.Marital;
        this.HomeAddress.Text = model.HomeAddress;
        this.QQ.Text = model.QQ;
        this.mail.Text = model.mail;
    }

    private void LoadStaff(string StaffID)
    {
        Ylh.BLL.StaffBLL bll = new StaffBLL(DbConnectionStr);
        DataTable dt = bll.GetStaff(Convert.ToInt32(StaffID));
        this.StaffName.Text = dt.Rows[0]["StaffName"].ToString();
        Department.Text = dt.Rows[0]["DepartmentName"].ToString();
        RoleName.Text = dt.Rows[0]["RoleName"] != null ? dt.Rows[0]["RoleName"].ToString() : "";
        this.RoleID.Text = dt.Rows[0]["RoleID"] != null ? dt.Rows[0]["RoleID"].ToString() : "";
        StaffLoginName.Text = dt.Rows[0]["StaffLoginName"].ToString();
    }
}